#ifndef ENHANCEWRAPPER_H
#define ENHANCEWRAPPER_H

#include <iostream>

#include <time.h>
#include <math.h>

#include <acl/acl.h>
#include <opencv2/opencv.hpp>

#include "Network/NetworkTools.h"

class EnhanceWrapper
{
public:
    explicit EnhanceWrapper(std::string modelPath);
    ~EnhanceWrapper();

public:
    cv::Mat infer(std::string imageSrc);

private:
    cv::Mat postProcess(const std::vector<float> &buffer, cv::Size oriSize);
    std::vector<float> _infer(cv::Mat transDim);
    std::pair<cv::Mat, cv::Size> preprocess(std::string imageSrc);

private:
    void initCannContext(std::string modelPath);
    void initModelResource();

private:
    // cann runtime 
    aclrtContext context;
    aclrtStream stream;
    uint32_t modelId;
    aclmdlDesc *modelDesc;
    aclrtRunMode runMode;

    // data ptr
    aclmdlDataset *deviceInputDataset, *deviceOutputDataset;
    void *deviceInputBuffer, *deviceOutputBuffer;
    size_t deviceInputBufferSize, deviceOutputBufferSize;
    void *hostOutBuffer;
};

#endif // ENHANCEWRAPPER_H